    //-------------------------------------------------------------------------------
    // Shows an image using some kind of effect
    //-------------------------------------------------------------------------------
    function showImage(url)
    {
        var contentNode = dojo.byId("canvasImage");
		
		dojo.fadeOut(
		    {
		        node    : contentNode,
			    duration: 2000,
			    onEnd   : function() {
			        // set the data, fade it back in
				    contentNode.src = url; 
				    dojo.fadeIn({node: contentNode}).play();    
			    }
            }
        ).play();
    }
    
    //-------------------------------------------------------------------------------
    // Handles the next button click
    //-------------------------------------------------------------------------------
    function next(url) 
    {
        showImage(url);
    }
    
    //-------------------------------------------------------------------------------
    // Handles the next button click
    //-------------------------------------------------------------------------------
    function prev(url) 
    {
        showImage(url);
    }
    
    //-------------------------------------------------------------------------------
    // Shows console message
    //-------------------------------------------------------------------------------
    function consoleWrite(message)
    {
        dojo.byId("console").value += "[INFO]: " + message + "\r\n";   
    }
    
    //-------------------------------------------------------------------------------
    // Shows console message
    // See: http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/using-dojo-data/available-stores/flickr-rest-s
    //-------------------------------------------------------------------------------
    function getFlickrPhotos(targetId, count) 
    {
        var flickrRestStore = new dojox.data.FlickrRestStore();
        
        var request = 
        {
            query: 
            {
                userid: flickrUser,
                apikey: flickrApiKey                                        
            },
            onBegin     : function (totalCount, requestObj) 
            { 
                consoleWrite("Starting..."); 
                consoleWrite("Found (" + totalCount + ") items");   
            },
            onItem      : function (item, requestObj) 
            { 
                consoleWrite(
                    "Item: " + item.title + ", " + 
                    "[" + flickrRestStore.getValue(item, "imageUrlSmall") + "]"
                );
                
                var img = document.createElement("img");
                img.setAttribute("src", flickrRestStore.getValue(item, "imageUrlSmall"));
                
                dojo.byId(targetId).appendChild(img);
            } ,
            onComplete  : function (items, request) { consoleWrite("Done"); },
            onError     : function (error, request) { consoleWrite("Error: " + error); },
        };
        
        request.start       = 0; // start at the beginning
        request.count       = count; 
        request.query.tags  = ["dublin"];
       
        request.query.sort = 
        [{
            //'attribute' could also be "date-taken" or "date-posted"
            attribute: "date-taken", 
            descending: true
        }];
        
        return flickrRestStore.fetch(request);
    }